
<include file="Public/header" />
    <script type="text/javascript" charset="utf-8" src="__ROOT__/public/doc/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="__ROOT__/public/doc/ueditor.all.min.js"> </script>
    <link rel="stylesheet" href="__ROOT__/public/home/css/release-form.css">
    <section class="rlease-form rel-rep">
        <div class="container">
            <form id="regForm" class="form-horizontal" action="{:U('Report/ReleaseReport')}" method="post" enctype="multipart/form-data">

                <div class="form-group">
                    <label class="control-label col-lg-2 col-xs-3" for="">标题：</label>
                    <div class="input-group col-lg-6 col-xs-8">
                        <input class="form-control" type="text" name="title" msg="标题" placeholder="请输入标题（必填）">
                        <input class="form-control" type="hidden" name="agree" value='0'>
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label col-lg-2 col-xs-3" for="">姓名：</label>
                    <div class="input-group col-lg-6 col-xs-8" id="ap">
                        <input class="form-control" type="text" name="bereport"  msg="姓名" placeholder="请输入被举报人姓名（必填）">
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label col-lg-2 col-xs-3" for="">手机：</label>
                    <div class="input-group col-lg-6 col-xs-8">
                        <input class="form-control" type="text" name="betel"  msg="手机号"  placeholder="请输入被举报人手机（必填）">
                    </div>
                </div>
                 <div class="form-group">
                        <label class="control-label col-lg-2 col-xs-3" for="">身份证号：</label>
                        <div class="input-group col-lg-6 col-xs-8">
                            <input class="form-control" type="card" name="becard"  msg="身份证号" placeholder="请输入被表扬人身份证号">
                        </div>
                    </div>
                <div class="form-group">
                    <label class="control-label col-lg-2 col-xs-3" for="">邮箱：</label>
                    <div class="input-group col-lg-6 col-xs-8">
                        <input class="form-control" type="emai" name="email"  msg="邮箱" placeholder="请输入被举报人邮箱">
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-lg-2 col-xs-3" for="">籍贯：</label>
                    <div class="input-group col-lg-6 col-xs-8">
                        <input class="form-control" type="text" name="native_place"  msg="籍贯" placeholder="请输入被举报人籍贯（必填）">
                    </div>
                </div>


                <div class="form-group">
                    <label class="control-label col-lg-2 col-xs-3" for="">内容：</label>
                    <div class="input-group col-lg-9 col-xs-8">
                        <textarea class="form-control visible-xs-block" name="content" placeholder="请输入内容"></textarea>
                         <div class="hidden-xs input-group  col-sm-10" >
                              
                         
                            <script name='content' id="editor" type="text/plain" style="width:110%;height:500px;"></script>
                                                <script type="text/javascript">
                                                var ue = UE.getEditor('editor');
                                                </script>
                                                   </div>
                    </div>
                </div>




                <div class="form-group rep1">
                    <label class="control-label col-lg-2 col-xs-3" for="">附件：</label>
                    <div class="input-group col-lg-9 col-xs-8 input-append">
                        <input id="lefile" type="file" name="lefile" style="display:none">
                        <input id="photoCover" placeholder="用于证明事件的真实性" class="input-large ">
                        <span class="file-click hidden-xs">上传</span>
                    </div>
                </div>
                <div class="form-group">
                        <label class="control-label col-lg-2 col-xs-3" for="">备注：</label>
                        <div class="input-group col-lg-9 col-xs-8">
                            <p style="color:red;margin-top: 7px;">请注意，证明文件请压缩成rar格式或者zip格式后上传。审核通过后将在页面展示。<if condition="$Think.config.report_money neq '0'">删除时需要平台建设费{$Think.config.report_money}元/条</if></p>
                        </div>
                    </div>


                <div class="form-group rep2">
                    <label class="control-label col-lg-2 col-xs-3" for=""></label>
                    <div class="input-group col-lg-9 col-xs-8 input-append">
                        <div class="change">
                           <span>
                                <input id="ck3" type="checkbox" name="see_name" value="0">
                                <i></i>
                                <label for="ck3">显示自己的姓名</label >
                            </span>
                            <span>
                                <input id="ck1" type="checkbox" name="see_tel" value="0">
                                <i></i>
                                <label for="ck1">显示自己的手机号</label >
                            </span>

                            <span>
                                <input id="ck2" type="checkbox" name="see_qq" value="0">
                                <i></i>                                       
                                <label for="ck2">显示自己的QQ</label >
                            </span>

                        </div>


                    </div>
                </div>




                <div class="form-group">
                    <label class="control-label col-lg-2 col-xs-3" for=""></label>
                    <div class="input-group col-lg-6 col-xs-8">
                        <input class="form-control" onclick="return checkNull()"  id="g-btn" type="submit" name="" value="发布" />
                    </div>
                </div>



            </form>


        </div>
    </section>

    <include file="Public/footer" />


    <script type="text/javascript">
        $(function () {

           var w = $(window).width();
           if(w<769){
               var $por = $("#photoCover");
               $por.val("上传");
           
           }

            $(".file-click,#photoCover").click(function () {
                $('#lefile').click();
            });

            

            $('#lefile').change(function () {
                $('#photoCover').val($(this).val());

            })
            $("#ck1").click(function(){
              var mytel=$(this).val();
              if(mytel==1){
                $(this).attr('value',0);
              }else{
                $(this).attr('value',1);
              }
            })
            $("#ck2").click(function(){
              var myqq=$(this).val();
              if(myqq==1){
                $(this).attr('value',0);
              }else{
                $(this).attr('value',1);
              }
            })
            $("#ck3").click(function(){
              var myname=$(this).val();
              if(myname==1){
                $(this).attr('value',0);
              }else{
                $(this).attr('value',1);
              }
            })

        })
        function checkNull()
        {
             var num=0;
             var str="";
             $("input[type$='text']").each(function(n){
                  if($(this).val()=="")
                  {
                       num++;
                       str+=$(this).attr("msg")+"不能为空！\r\n";
                  }
             });
             if(num>0)
             {
                  alert(str);
                  return false;
             }
             else
             {
                var datas=$("#regForm").serialize();
                var url=$("#regForm").attr('action');
                $.ajax({
                    type:'post',
                    url:"{:U('Report/pregReport')}",
                    data:datas,
                    async:false,
                    dataType:'json',
                    success:function(msg){
                        if(msg.code==1){

                           $("input[name='agree']").attr('value',1);
                         }else{
                          alert(msg.msg);
                          $("input[name='agree']").attr('value',2);
                         }
                    }
                })
                var vals=$("input[name='agree']").val();
                if(vals==1){
                  return true;
                }else{
                  return false;
                }
             }
        }
   

    </script>